import time

from selenium.webdriver.common.by import By
from appium.webdriver.common.appiumby import By

from pages.page01_index import app_index_page
from tools import app_driver


def app_login_page(driver,phone,password):
    time.sleep(2)
    driver.find_element(by=By.ID,value='com.tpshop.malls:id/mine_ll').click()
    time.sleep(2)
    driver.find_element(by=By.ID,value='com.tpshop.malls:id/head_img').click()
    driver.find_element(by=By.XPATH,value='//android.widget.EditText[@text="请输入账号"]').send_keys(phone)
    driver.find_element(by=By.XPATH,value='//android.widget.EditText[@text="请输入密码"]').send_keys(password)
    driver.find_element(by=By.ID,value='com.tpshop.malls:id/agree_btn').click()
    time.sleep(2)
    driver.find_element(by=By.ID,value='com.tpshop.malls:id/login_tv').click()


    pass
if __name__ == '__main__':
    driver = app_driver()
    app_index_page(driver)
    app_login_page(driver)